package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.INursingProjectService;
import com.zzyl.nursing.service.impl.NursingProjectServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Api(tags = "小程序端查询护理项目")
@RestController
@RequestMapping("/member/orders/project")
public class MemberOrderController extends BaseController {

    @Autowired
    private NursingProjectServiceImpl nursingProjectService;


    @GetMapping("/page")
    @ApiOperation("查询护理项目列表")
    public TableDataInfo<NursingProject> page(String name,Integer pageNum,Integer pageSize,Integer status){

        log.info("接收到数据",name,pageNum,pageSize,status);
        TableDataInfo<NursingProject> tableDataInfo = nursingProjectService.PageByNameAndStatus(name, pageNum, pageSize, status);
        log.info("查到数据{}",tableDataInfo.getRows());
        tableDataInfo.setCode(200);
        tableDataInfo.setMsg("查询成功");
        return tableDataInfo;
    }


    @GetMapping("/{id}")
    public AjaxResult detialPage(@PathVariable Integer id)
    {
        NursingProject nursingProject = nursingProjectService.getById(id);
        return AjaxResult.success(nursingProject);
    }


}
